﻿/*------------------------------------------------
// File Description: ReworkOrder DataBase Entity
// Author:			 Crane
// Create Time:		 2020-06-22 09:04:52
//------------------------------------------------*/

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using IOA.MES.DataAccess.Enum;

namespace IOA.MES.DataAccess.Entity
{
    /// <summary>
    /// 返修工单
    /// </summary>
    [Table(nameof(ReworkOrder))]
    public class ReworkOrder : BaseEntity
    {
        private string _reworkNo = string.Empty;
        private string _orderNo = string.Empty;
        private string _customerCode = string.Empty;
        private string _customerName = string.Empty;
        private string _workshopCode;
        private string _workshopName;
        private string _remark;
        private string _reviewDesc;

        #region Public Property

        ///<Summary>
        /// 返修类型（按订单、按工单）
        ///</Summary>
        public Enum.ReworkType ReworkType { get; set; }

        ///<Summary>
        /// ReworkNo
        ///</Summary>
        public string ReworkNo
        {
            get { return string.IsNullOrWhiteSpace(_reworkNo) ? string.Empty : _reworkNo; }
            set { _reworkNo = value; }
        }

        ///<Summary>
        /// 订单号
        ///</Summary>
        public string OrderNo
        {
            get { return string.IsNullOrWhiteSpace(_orderNo) ? string.Empty : _orderNo; }
            set { _orderNo = value; }
        }

        ///<Summary>
        /// 客户代码
        ///</Summary>
        public string CustomerCode
        {
            get { return string.IsNullOrWhiteSpace(_customerCode) ? string.Empty : _customerCode; }
            set { _customerCode = value; }
        }

        ///<Summary>
        /// 客户名称
        ///</Summary>
        public string CustomerName
        {
            get { return string.IsNullOrWhiteSpace(_customerName) ? string.Empty : _customerName; }
            set { _customerName = value; }
        }

        ///<Summary>
        /// 车间代码
        ///</Summary>
        public string WorkshopCode
        {
            get { return string.IsNullOrWhiteSpace(_workshopCode) ? string.Empty : _workshopCode; }
            set { _workshopCode = value; }
        }

        ///<Summary>
        /// 车间名称
        ///</Summary>
        public string WorkshopName
        {
            get { return string.IsNullOrWhiteSpace(_workshopName) ? string.Empty : _workshopName; }
            set { _workshopName = value; }
        }

        /// <summary>
        /// 生产状态
        /// </summary>
        public ProduceStatus ProduceStatus { get; set; }

        ///<Summary>
        /// 返工说明
        ///</Summary>
        public string Remark
        {
            get { return string.IsNullOrWhiteSpace(_remark) ? string.Empty : _remark; }
            set { _remark = value; }
        }

        ///<Summary>
        /// 审核状态
        ///</Summary>
        public Enum.ReviewStatus ReviewStatus { get; set; }

        ///<Summary>
        /// 审核人
        ///</Summary>
        public int ReviewBy { get; set; }

        ///<Summary>
        /// 审核时间
        ///</Summary>
        public DateTime? ReviewTime { get; set; }

        ///<Summary>
        /// 审核说明
        ///</Summary>
        public string ReviewDesc
        {
            get { return string.IsNullOrWhiteSpace(_reviewDesc) ? string.Empty : _reviewDesc; }
            set { _reviewDesc = value; }
        }
        #endregion
    }

    public partial class MESContext
    {
        /// <summary>
        /// 返修工单
        /// </summary>
        public virtual DbSet<ReworkOrder> ReworkOrders { get; set; }
    }
}